package netw;

import hypercast.NotificationHandler;
import hypercast.events.E2EACK_RECEIVED;
import hypercast.events.E2EPARTIALACK_RECEIVED;
import hypercast.events.INTERNAL_EVENT;
import hypercast.events.MSG_WITH_E2EACK_SENT;
import hypercast.events.NAMING_EVENT;
import hypercast.events.NEWSTREAM_ARRIVED_EVENT;
import hypercast.events.NODE_ISSTABLE;
import hypercast.events.NODE_LEAVEOVERLAY;
import hypercast.events.NODE_LOGICALADDRESSCHANGED;
import hypercast.events.NODE_NEIGHBORHOODCHANGED;
import hypercast.events.NOTIFICATION_EVENT;

public class Notifications extends NotificationHandler {
	Overlay net;
	Users usr;

	public Notifications(Overlay n, Users u) {
		net = n;
		usr = u;
	}

	public void handle_NODE_ISSTABLE(NODE_ISSTABLE event) {
		System.out.println("event NODE_ISSTABLE has occured!");
	}

	public void handle_NODE_NEIGHBORHOODCHANGED(NODE_NEIGHBORHOODCHANGED event) {
		usr.advertise(0);
		usr.advertise(400);
	}

	public void handle_E2EACK_RECEIVED(E2EACK_RECEIVED event) {
		System.out.println("event E2EACK_RECEIVED has occured!");
	}

	public void handle_E2EPARTIALACK_RECEIVED(E2EPARTIALACK_RECEIVED event) {
		System.out.println("event E2EPARTIALACK_RECEIVED has occured!");
	}

	public void handle_MSG_WITH_E2EACK_SENT(MSG_WITH_E2EACK_SENT event) {
		System.out.println("event MSG_WITH_E2EACK_SENT has occured!");
	}

	public void handle_INTERNAL_EVENT(INTERNAL_EVENT event) {
		System.out.println("event INTERNAL_EVENT has occured!");
	}

	public void handle_NAMING_EVENT(NAMING_EVENT event) {
		System.out.println("event NAMING_EVENT has occured!");
	}

	public void handle_NEWSTREAM_ARRIVED_EVENT(NEWSTREAM_ARRIVED_EVENT event) {
		System.out.println("event NEWSTREAM_ARRIVED_EVENT  has occured!");
		net.ReceiveStream();
	}

	public void handle_NODE_LEAVEOVERLAY(NODE_LEAVEOVERLAY event) {
		System.out.println("event NODE_LEAVEOVERLAY has occured!");
	}

	public void handle_NODE_LOGICALADDRESSCHANGED(
			NODE_LOGICALADDRESSCHANGED event) {
		System.out.println("event NODE_LOGICALADDRESSCHANGED has occured!");
	}

	public void handle_NOTIFICATION_EVENT(NOTIFICATION_EVENT event) {
		System.out.println("event NOTIFICATION_EVENT has occured!");
	}
}
